package tools;

/**
 * 这里是一个注释
 *
 * @author scw
 * @version v1.0
 * @date
 */
public class Test {


    public static void main(String[] args) {
                              // 8421
        String decStr = "12"; // 1100
        System.out.println("decimal string: " + decStr);
        try {
            // 十进制字符串转BCD码
            byte[] bcd = BcdCodeTransfer.decimalStringToBcd(decStr);
            System.out.println("after transferring got BCD Code:");
            for (int i = 0; i < bcd.length; i++) {
                System.out.println("byte " + i + ": " + Integer.toBinaryString(bcd[i]));
            }
            System.out.println("---------------------------------");

            // BCD码转十进制字符串
            System.out.println("after transferring got decimal string:");
            System.out.println(BcdCodeTransfer.bcdToDecimalString(bcd));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
